package com.ftg.learn.chapter03.manyarray;

import java.util.Arrays;

/**
 * @author 布衣
 */
public class LearnTwoArray {

    public static void main(String[] args) {

        int[][] arr01 = new int[3][5];

        for (int i1 = 0; i1 < arr01[0].length; i1++) {
            for (int i = 0; i < arr01.length; i++) {
                arr01[i][i1] = (i+1) + i1 * 3;
            }
        }

        //i 行0 1 2
//        for (int i = 0; i < arr01.length; i++) {
//            for (int i1 = 0; i1 < arr01[i].length; i1++) {
//                arr01[i][i1] = i * 5 + i1 + 1;
//            }
//        }

        for (int i = 0; i < arr01.length; i++) {
            System.out.println(Arrays.toString(arr01[i]));
        }

        //3 行 5 列的二维数组
        //1,把一到15赋值进去

//       1 5
//       6 10
//       11 -15
//         1 4 7
//         2 5 8
//         3 6 9

        int[][] b = new int[2][2];
        b[0][0] = 2;
        b[0][1] = 3;
        b[1][0] = 4;
        b[1][1] = 5;

        for (int i = 0; i < b.length; i++) {
            for (int j = 0; j < b[i].length; j++) {
                System.out.println(b[i][j]);
            }
        }

        int[][] a = new int[2][];

        System.out.println();
        a[0] = new int[]{1, 2, 3};
        a[1] = new int[]{4, 5, 6, 7, 8, 9, 10};

        for (int i = 0; i < a.length; i++) {
            for (int i1 = 0; i1 < a[i].length; i1++) {
                System.out.print(a[i][i1] + "\t");
            }
            System.out.println();
        }

    }

}
